import React, { Component } from "react";
import qs from 'querystring'

const DetailData = [
    { id: '1', content: "我爱中国" },
    { id: '2', content: "我爱点点" },
    { id: '3', content: "我爱圈圈" },
  ]
export default class Detail extends Component {
  render() {
    // const { id, title } = this.props.match.params;
    const search = this.props.location.search
    const {id,title} = qs.parse(search.slice(1))
    const findResult = DetailData.find((contentObj)=>{
        return contentObj.id === id
    })
    return (
      <ul>
        <li>ID: {id}</li>
        <li>Title: {title}</li>
        <li>CONTENT: {findResult.content}</li>
      </ul>
    );
  }
}
